/*
 * CTDR_Carrier.h
 *
 *  Created on: 1 déc. 2010
 *      Author: mbenoit
 */

#ifndef CTDR_CARRIER_H_
#define CTDR_CARRIER_H_

#include "CTDR_Field.h"
#include "global.h"
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <string>
using namespace std;
enum Etats {piege,libre};      // type de variable definisant l'etat d'un CTDR_Electron piegï¿½ou libre
enum E_piege {profond,normal};
enum E_collecte {collecte,Libre};


class CTDR_Carrier {

protected :
	long double x;	//Position in X
	long double y;	//Position in Y
	long double z;	//Position in Z
	long double dx;	//Position in X
	long double dy;	//Position in Y
	long double dz;	//Position in Z
	long double Q;	//Charge
	long double Energy;
	long double mobilite;	//Mobility
	long double D;	//Diffusion coefficient
	double Temps_piegeage;	//Time until next trap
	double Temps_depiegeage;	//Time before detrapping
	Etats Etat;	//true=piege, false =libre
	E_piege Etat_prochain_piege;	//true = profond , false=normal
	E_collecte E_collection;	//Collection state
	double Erreur;


public :
	CTDR_Carrier();
	void MobilityHole(double parElectricField);
	void MobilityElectron(double parElectricField);


	void SetValeurInitial(double x,double y, double z, double mobilite,double Q);

	void SetD(double D){this->D=D;};

	void SetMobility(double mu){this->mobilite=mu;};

	void SetPosition(double x,double y, double z);

	void SetEtat(Etats etat_voulu,E_piege etat_piege_voulu);

	void Collecte(double z);

	E_collecte GetEcollecte();

	long double GetX
	();
	long double GetY
	();
	long double GetZ
	();

	long double GetQ
	();

	double GetErreur
	();

	Etats GetEtat
	();

	void Piege
	();

	void Depiege
	();

	void Diffusion_Repulsion(bool diffusion, bool repulsion,double xrms, double yrms, double zrms,int N,double dt);


	void Transport(double Ex, double Ey, double Ez,double dt);

	void Transport(CTDR_Field &champ,double dt);

	void Iterateur(double dt,int N,double xrms,double yrms,double zrms,CTDR_Field &A);

	//ClassDef(CTDR_Carrier, 0) //A charge element
};

#endif /* CTDR_CARRIER_H_ */
